<template>
  <div class="bid-info">
      <h3>
        招评标基本信息
        <el-button size="mini" @click="$router.push({name:'tender'})">返回</el-button>
        <el-button size="mini" @click="submitTrue(-1)" v-if="status===0">拒绝</el-button>
        <el-button size="mini" @click="submitTrue(1)" v-if="status===0">应标</el-button>
      </h3>
      <div class="info-div">
          <div class="info-title">
              <span>招标信息 : {{infoData.psNo}}</span>
          </div>
          <div class="info-text w100">
              <span class="text-label">项目名称：</span>
              <span class="text-value">{{infoData.psTitle}}</span>
          </div>
          <div class="info-text">
              <span class="text-label">采购组织：</span>
              <span class="text-value">{{infoData.purOrgName}}</span>
          </div>
          <div class="info-text">
              <span class="text-label"> 采购组：</span>
              <span class="text-value">{{infoData.purGroupName}}</span>
          </div>
          <div class="info-text">
              <span class="text-label">招标负责人：</span>
              <span class="text-value">{{infoData.leaderUserName}}</span>
          </div>
          <div class="info-text">
              <span class="text-label">品类：</span>
              <span class="text-value">{{infoData.categoryName}}</span>
          </div>
          <div class="info-text">
              <span class="text-label">最小开标数量：</span>
              <span class="text-value">{{infoData.minOpenNum}}</span>
          </div>
          <div class="info-text">
              <span class="text-label">是否框架招标：</span>
              <span class="text-value">
                  {{infoData.isFrame == 1 ? '是' : '否'}}
              </span>
          </div>
          <div class="info-text">
              <span class="text-label">是否要保证金：</span>
              <span class="text-value">
                  {{infoData.isNeedBond == 1 ? '需要' : '不需要'}}
              </span>
          </div>
          <div class="info-text">
              <span class="text-label">是否开技术标：</span>
              <span class="text-value">
                   {{infoData.isNeedTecbidding == 1 ? '是' : '否'}}
              </span>
          </div>
          <div class="info-text w100">
              <span class="text-label">招标说明：</span>
              <span class="text-value">{{infoData.notice}}</span>
          </div>
      </div>
      <div class="info-div">
          <div class="info-title">
              <span>招标时间</span>
          </div>
          <div class="info-text w50">
              <span class="text-label">
                  投标截止日期：
              </span>
              <span class="text-value">{{infoData.tenderEtimeStr}}</span>
          </div>
          <div class="info-text w50">
              <span class="text-label">
                  开标日期：
              </span>
              <span class="text-value">{{infoData.openTimeStr}}</span>
          </div>
      </div>
      <div class="info-div">
          <div class="info-title">
              <span>招标标的</span>
          </div>
        <el-table :data="bieItemData" border>
            <el-table-column label="供货区域" align="center" prop="purOrgName"></el-table-column>
            <el-table-column label="工厂" align="center" prop="factoryName"></el-table-column>
            <el-table-column label="物料编码" align="center" prop="materialCode"></el-table-column>
            <el-table-column label="物料名称" align="center" prop="materialName"></el-table-column>
            <el-table-column label="型号/规格" align="center" prop="materialSpec"></el-table-column>
            <el-table-column label="单位" align="center" prop="stockUnit"></el-table-column>
            <el-table-column label="质保期" align="center" prop="qualityTime"></el-table-column>
            <el-table-column label="采购量" align="center" prop="planQty"></el-table-column>
            <el-table-column label="交期" align="center" prop="deliveryDate"></el-table-column>
            <el-table-column label="备注" align="center" prop="remarks"></el-table-column>
        </el-table>
      </div>
      <div class="info-div">
          <div class="info-title">
            <span>评标方法</span>
          </div>
          <div class="info-text w50">
            <span class="text-label">
                招标需求：
            </span>
            <span class="text-value">             
              <a href="javascript:;" @click="downloadFile(infoData.tenderFilePath,infoData.tenderFileName)" class="download_color">{{infoData.tenderFileName}}</a>
            </span>
          </div>
          <div class="info-text w50">
            <span class="text-label">
                技术评分方法：
            </span>
            <span class="text-value">{{infoData.tecUserDefinedAtt}}</span>
          </div>
          <div class="info-text w50">
            <span class="text-label">
                招标标书：
            </span>
            <span class="text-value">
                <a href="javascript:;" @click="downloadFile(infoData.tenderDemandPath,infoData.tenderDemandName)" class="download_color">{{infoData.tenderDemandName}}</a>
            </span>
          </div>
          <div class="info-text w50">
            <span class="text-label">
                商务评分方法：
            </span>
            <span class="text-value">{{infoData.bsUserDefinedAtt}}</span>
          </div>
      </div>

  </div>
</template>
<script>
import qs from 'qs';
  export default {
    props:['stepData'],
    data() {
      return {
          infoData:{},
          bidVendor:{},
          bieItemData:[]
      };
    },
    computed:{
        status(){
            return this.stepData.bidVendor.responseStatus===0?0:1;
        }
    },
    mounted(){
       this.infoData=this.stepData.bidMainDto;
       this.bidVendor=this.stepData.bidVendor;
       this.bieItemData=this.stepData.bidMaterials;
    },
    methods: {
      submitTrue(type){
        let title=type===1?'确认应标？':'确认拒绝？'
        this.$confirm(title, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.axios.post(`${this.lib.config.host.bidtender}/bidmgt/tender/response/${this.$route.query.id}/${type}`).then((response)=>{
            this.$message({
              type: 'success',
              message: '恭喜您应标成功!'
            });
          });
        }).catch(() => {
            console.log()
        });
      },
      // 下载附件
      download(filePath, fileName) {
        this.downloadFile(filePath, fileName);
      }
    }
  }

</script>
